﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace LotteryBO
{
    class Player_data
    {
       iDAC dac = DACFactory.GetDAC();
       private long _player_id = -99;
       private string _name = "";
       private string _address = "";
       private string _city = "";
       private string _state = "";
       private long _zipcode = -99;
       private string _sex = "";
       private string _dob = "1/1/1800";
       private string _mail_id = "";
       private long _phone_no = -99;
       private long _mobile_no = -99;
       private long _balance = -99;
       private string _nominee_name = "";
       private bool _isdeleted = false;
       
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long player_id
        {
            get
            {
                return _player_id;
            }
            set
            {
                _player_id = value;
            }
        }
        public string name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }
        public string address
        {
            get
            {
                return _address;
            }
            set
            {
                _address= value;
            }
        }
        public string city
        {
            get
            {
                return _city;
            }
            set
            {
                _city = value;
            }
        }
        public string state
        {
            get
            {
                return _state;
            }
            set
            {
                _state = value;
            }
        }
        public long zipcode
        {
            get
            {
                return _zipcode;
            }
            set
            {
                _zipcode = value;
            }
        }
        public string sex
        {
            get
            {
                return _sex;
            }
            set
            {
                _sex= value;
            }
        }
         public string dob
        {
            get
            {
                return _dob;
            }
            set
            {
                _dob = value;
            }
        }

         public string mail_id
         {
             get
             {
                 return _mail_id;
             }
             set
             {
                 _mail_id = value;
             }
         }
         public long phone_no
         {
             get
             {
                 return _phone_no;
             }
             set
             {
                 _phone_no= value;
             }
         }
         public long mobile_no
         {
             get
             {
                 return _mobile_no;
             }
             set
             {
                 _mobile_no = value;
             }
         }
         public long balance
         {
             get
             {
                 return _balance;
             }
             set
             {
                 _balance = value;
             }
         }
         public string nominee_name
         {
             get
             {
                 return _nominee_name;
             }
             set
             {
                 _nominee_name = value;
             }
         }

        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = dac.Parameter("@player_id",player_id ,DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = dac.Parameter("@name",name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = dac.Parameter("@address",address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = dac.Parameter("@city", city, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = dac.Parameter("@state", state, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = dac.Parameter("@zipcode",zipcode , DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = dac.Parameter("@sex", sex, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = dac.Parameter("@dob", dob, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = dac.Parameter("@mail_id", mail_id, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam9 = dac.Parameter("@phone_no",phone_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = dac.Parameter("@mobile_no", mobile_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = dac.Parameter("@balance", balance, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam12 = dac.Parameter("@nominee_name", nominee_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = dac.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6,dbparam7,dbparam8,dbparam9,dbparam10,dbparam11,dbparam12,dbparam13 };
                return dac.Save("Player_data_save", dbparamcall);
            }
            catch(Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long _player_id,string _name,string _address,string _city,string _state,long _zipcode,string _sex,string _dob,string _mail_id,long _phone_no,long _mobile_no,long _balance,string _nominee_name,bool _isdeleted,string andor)
        {
            try
            {
                DbParameter dbparam0 = dac.Parameter("@player_id", player_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = dac.Parameter("@name", name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = dac.Parameter("@address", address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = dac.Parameter("@city", city, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = dac.Parameter("@state", state, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = dac.Parameter("@zipcode", zipcode, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = dac.Parameter("@sex", sex, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = dac.Parameter("@dob", dob, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = dac.Parameter("@mail_id", mail_id, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam9 = dac.Parameter("@phone_no", phone_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = dac.Parameter("@mobile_no", mobile_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = dac.Parameter("@balance", balance, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam12 = dac.Parameter("@nominee_name", nominee_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = dac.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13 };
                DataTable dt1 = dac.Select("Player_data_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }           
                    
              
           
    }
    
}
    

